<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>  
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
	<head>
		<title>Machinery Rental Login</title>

		<link rel="stylesheet" href="<c:url value="/resources/css/main.css" />">
		<script src="<c:url value="/resources/js/bootstrap.min.js" />"></script>
        <script src="<c:url value="/resources/js/scripts.js" />"></script>
	</head>
	<body onload='document.loginForm.username.focus();'>
		
		<div class="container">

			<h2><fmt:message key="login" /></h2>
			
			<%

				String errorString = (String) request.getAttribute("error");
				if (errorString != null && errorString.trim().equals("true")) {
					out.println("Incorrect login name or password. Please retry using correct login name and password.");
				}
			%>

			<c:url var="loginUrl" value="/login.do" />
			<form:form name='loginForm' action="${loginUrl}" method='POST' class="form-horizontal" >

				<div class="form-group">
					 <label for="username" class="control-label col-sm-2"><fmt:message key="login.user" />:</label>
					
					<div class="col-sm-10">
						<input type='text' name='username' value='' class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label for="password" class="control-label col-sm-2"><fmt:message key="login.password" />:</label>
					<div class="col-sm-10">
						<input type='password' name='password' class="form-control" />
					</div>
				</div>
						
						
				<div class="form-group">        
					<div class="col-sm-offset-2 col-sm-9">
						<input name="submit" type="submit" value="<fmt:message key="login.login" />" />
						
					</div>
				</div>
					
					</form:form>

		</div>
	</body>
</html>